package com.youdianstar.app.support

import android.content.Context
import com.youdianstar.app.common.Extra
import com.youdianstar.app.entity.OrderInfo
import com.youdianstar.app.common.ex.toJson
import com.youdianstar.app.ui.pay.PaymentCodeActivity
import com.youdianstar.app.common.auko.startActivity

/**
 * File: ActionEx
 * Author: 82149 Create: 2023/7/19 15:11
 * Changes (from 2023/7/19)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 *
 */

/**
 * 跳转支付页面 ARouter
 *
 * @param bisType 1-租借 3-会员 5-押金 7-报失 9-添加卡 11-优惠券 13-购买 15-置换
 * @param amount 支付金额
 * @param orderNo 订单号
 * @param chargingId 充电卡Id
 * @param couponId 优惠券id
 */
fun paymentActionIntent(
    context: Context,
    bisType: Int, amount: Double,
    orderNo: String? = null, orderInfo: OrderInfo? = null,
    chargingId: Int = 0,
    couponId: String? = null
){
    context.startActivity<PaymentCodeActivity>(
        Extra.IT_TYPE to bisType,
        Extra.IT_MONEY to amount,
        Extra.IT_ORDERNO to orderNo, Extra.IT_DATA to orderInfo?.toJson(),
        Extra.IT_CHARGING to chargingId,
        Extra.IT_COUPON to couponId
    )
}